$("#roleAdd").click(function () {
    var roleName = $("#roleName").val();
    $.ajax({
        url: "/account/role/add",
        type: "POST",
        datatype: "JSON",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify({"roleName":roleName}),
        success: function(data){
            if (data.success){
                window.parent.parent.layer.msg("添加成功！",{
                    area: ['200px', '50px'],
                    title: false,
                    time: 1000,
                    offset: '100px'
                });
                window.parent.location.reload(true);
                layer_close();
            }else {
                window.parent.parent.layer.msg(data.cause,{
                    area: ['200px', '50px'],
                    title: false,
                    time: 1000,
                    offset: '100px'
                });
            }
        },
        error: function () {
            window.parent.parent.layer.msg("添加失败！",{
                area: ['200px', '50px'],
                title: false,
                time: 1000,
                offset: '100px'
            });
        }
    });
});